<template>
  <el-container>
    <el-main>
      <el-row>
        <el-col :span="16">
          <el-carousel indicator-position="outside" style="width:100%;">
            <el-carousel-item v-for="item in imgArray" :key="item" style="width: 100%">
              <img :src="item" class="rightImg">
            </el-carousel-item>
          </el-carousel>
        </el-col>
        <el-col :span="7">
          <personal-info-card>

          </personal-info-card>
        </el-col>
      </el-row>
      <div class="div2">
        <span>公告</span>
        <el-table :data="tableData" style="height: 400px; width: 800px; margin-top: 10px">
          <el-table-column prop="title" label="标题" width="180"/>
          <el-table-column prop="time" label="时间" width="180"/>
          <el-table-column prop="address" label="地址"/>
          <el-table-column prop="status" label="状态"/>
        </el-table>
      </div>
      <div class="div3">
        <div class="box">
          <el-table :data="monthlyTop" style="width: 100%">
            <el-table-column prop="name" label="Name" width="150"/>
            <el-table-column prop="num" label="AC" width="150"/>
          </el-table>
        </div>
        <div class="box">
          <el-table :data="weeklyTop" style="width: 100%">
            <el-table-column prop="name" label="Name" width="150"/>
            <el-table-column prop="num" label="AC" width="150"/>
          </el-table>
        </div>
        <div class="box">
          <el-table :data="daylyTop" style="width: 100%">
            <el-table-column prop="name" label="Name" width="150"/>
            <el-table-column prop="num" label="AC" width="150"/>
          </el-table>
        </div>
      </div>
    </el-main>
  </el-container>
</template>
<script>
import PersonalInfoCard from "@/components/PersonalInfoCard.vue";
import request from "@/utils/request";

export default {
  name: "HomeView",
  components: {PersonalInfoCard},
  data() {
    return {
      imgArray: [
        require('../assets/circle/img1.jpg'),
        require('../assets/circle/img2.jpg'),
        require('../assets/circle/img3.jpg'),
        require('../assets/circle/img4.jpg'),
        require('../assets/circle/img5.jpg')
      ],
      tableData: [
        {
          time: '2016-05-03',
          title: '[蔚蓝系列赛 Azur Series - Sponsored by bLue] Round 1',
          address: 'No. 189, Grove St, Los Angeles',
          status: 'Running',
        },
        {
          time: '2016-05-02',
          title: '山东理工大学第五届新生编程争霸赛',
          address: 'No. 189, Grove St, Los Angeles',
          status: 'Running',
        },
        {
          time: '2016-05-04',
          title: '2023级ACM集训队第二次选拔赛 (重现赛)',
          address: 'No. 189, Grove St, Los Angeles',
          status: 'Running',
        },
      ],
      monthlyTop: [
        {name: '张三', num: '5'},
        {name: '张三', num: '4'},
        {name: '张三', num: '3'},
        {name: '张三', num: '2'},
        {name: '张三', num: '1'}
      ],
      weeklyTop: [
        {name: '张三', num: '5'},
        {name: '张三', num: '4'},
        {name: '张三', num: '3'},
        {name: '张三', num: '2'},
        {name: '张三', num: '1'}
      ],
      daylyTop: [
        {name: '张三', num: '5'},
        {name: '张三', num: '4'},
        {name: '张三', num: '3'},
        {name: '张三', num: '2'},
        {name: '张三', num: '1'}
      ],
    }
  },beforeCreate() {
    request.get("/onlineStatuCheck").then((res) => {
      console.log("online")
    }).catch(()=>{
      this.$message.error("offline")
    })
  }
}
</script>
<style>
.container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.div1 {

}

.div2 {
  margin-top: 10px;
  margin-bottom: 30px;
  width: 100%;
  height: 200px;
}

.div3 {
  margin-top: 10px;
  width: 100%;
}

.box {
  width: 30%;
  height: 200px;
  float: left;
  margin: 0;
}

.rightImg {
  width: 100%;
  height: 100%;
}

.el-carousel__item h3 {
  color: #475669;
  font-size: 18px;
  opacity: 0.75;
  line-height: 300px;
  margin: 0;
  text-align: center;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
  background-color: #d3dce6;
}


.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
</style>